#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/wait.h>
int main()
{
    printf("testexec begin...\n");
    pid_t id=fork();
    char *const argv[]=
    {
        (char*)"ls",
        (char*)"-a",
        (char*)"-l",
        (char*)"--color",
        NULL
    };
    if(id==0)
    {
        execv("/usr/bin/ls",argv);
        exit(1);
    }
    int status=0;
    pid_t rid=waitpid(id,&status,0);
    if(rid>0)
    {
        printf("father wait success!child exit code:%d\n",WEXITSTATUS(status));
    }
    printf("testexec end!...\n");
    return 0;
}
